
import { _decorator, Component, Node } from 'cc';
import { ParticleItem } from './ParticleItem';
const { ccclass, property } = _decorator;
/**开枪火花特效 */
@ccclass('HuoHua')
export class HuoHua extends ParticleItem {

    protected particleCount: number = 18;
    protected createAnim() {
        let Pos = [0, 0, 0, 0];
        let SO = [0, 0, 1, 0.5];
        let Time = [0.3, 0.5, 0.5, 0];
        let Ease = [0, 0, 0, 0];
        let cr = 0.5;
        let s0 = 0.4;
        let stepRadian = 6.28 / this.particleCount;
        let index = 0;
        for (let i = 0; i < this.particleCount; ++i) {
            let radian = stepRadian * i;
            let x = cr * Math.cos(radian);
            let y = cr * Math.sin(radian);
            Pos[2] = x + (Math.random() - 0.5) * 0.2;
            Pos[3] = y + (Math.random() - 0.5) * 0.2;
            SO[0] = s0 + (Math.random() - 0.5) * 0.2;
            this.cacheParticleAnim(index++, Pos, SO, Time, Ease);
        }
    }

}

